/*
 * Copyright (c) 2019 Wormpex.com. All Rights Reserved.
 */

package com.sk.volat;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 可见性验证
 *
 * @author ke.su date: 2019-11-13 Time: 上午12:42
 */
public class VolatileTest2 {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newScheduledThreadPool(2);
         A a = new A();
        executorService.execute(() -> {
            try {
                Thread.sleep(100);
            } catch (Exception e) {

            }
            a.n = 1;

        });

        while (a.n == null) {

        }
        System.out.println("hello 结束了");

    }
}
